package com.example.config;

import com.example.bean.Car;
import com.example.bean.Woman;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = "com.example.bean")
public class SpringConfig3 {

    /**
     *
     * @param car 从容器中获取，Autowired可省略
     */
    @Bean
    public Woman woman(@Autowired Car car) {
        return new Woman(car);
    }

}


